#ifndef XCOREUSERDETAIL_H
#define XCOREUSERDETAIL_H
#include "useropeninfo.h"

namespace yc {

class UserDetail : public UserOpenInfo
{
public:
    enum Role { CREATOR_ROLE = 1, TEMPLATE_CREATOR_ROLE = 2, CENSOR_ROLE = 4, ADMIN_ROLE = 0xffff };

    UserDetail() { }
    UserDetail(int id, const QString& name) : UserOpenInfo(id, name) { }
    explicit UserDetail(const QJsonObject& jo) { updateData(jo); }

    const QString& phone() const { return phone_; }
    void setPhone(const QString& phone) { phone_ = phone; }
    const QString& email() const { return email_; }
    void setEmail(const QString& email) { email_ = email; }
    int role() const { return role_; }
    void setRole(int role) { role_ = role; }

    void updateData(const QJsonObject& jo);

private:
    QString phone_;
    QString email_;
    int role_ = CREATOR_ROLE;
};

} // namespace yc

#endif // XCOREUSERDETAIL_H
